﻿/*************************************************
Description:智能家居---设备搜索功能的实现
**************************************************/
#ifndef ENTERTAINMENTWIDGET_H
#define ENTERTAINMENTWIDGET_H

#include <QWidget>
#include <QUdpSocket>
#include <QTcpSocket>
#include <QJsonParseError>
#include <QJsonValue>
#include <QJsonDocument>
#include <QJsonObject>
#include <QFile>
#include <QFileInfo>
#include <QTimer>

namespace Ui {
class EntertainmentWidget;
}

class EntertainmentWidget : public QWidget
{
    Q_OBJECT
    
public:
    QHostAddress host;//ip地址
    quint16 port;   //端口
    QString backdata;
    int state;
    QString c_styleOn;
    QString c_styleOff;
    explicit EntertainmentWidget(QWidget *parent = 0);
    ~EntertainmentWidget();
    
private slots:

    void on_btnsearch_clicked();
    void on_btnconnect_clicked();
    void on_btnadd_clicked();
    void on_btndelete_clicked();
    void on_btnheart_clicked();


    void tcpconnect();
    void receiveData();
    void sendData(QString data);
    void heartbeat();




private:
    Ui::EntertainmentWidget *ui;
    QUdpSocket *udpsocket;
    QTcpSocket *tcpsocket;

signals:

    void tcpconnectsignalon();
    void tcpconnectsignaloff();

};

#endif // ENTERTAINMENTWIDGET_H
